-- task_kill_boss
-- Created by chengb Oct/31/2015
-- 击杀boss任务道具描述

return {
    -- 获取道具细节描述
    getDetail = function(itemId, args, para)
        assert(type(args) == "string", "detail_args期望是string类型。");

        local info = PropertyM.query(itemId);
        local taskId = info["args"]["dungeon_task"];

        assert(type(taskId) == "number", "task_id期望是number类型。");

        local curProgess      = DungeonTaskM.getProgress(taskId);
        local requireProgress = DungeonTaskM.query(taskId, "require_progress");

        local tasks = ME.user.dbase:query("dungeon_tasks", {});
        if type(tasks[taskId]) ~= 'table' then
            -- 尚未领取该任务？不应该啊
            trace("task_kill_boss", "###尚未领取任务(%d)", taskId);
            return args;
        end

        local targetId = tasks[taskId]["target_id"];
        local name = MonsterM.query(targetId, "name");
        if not name then
            trace("task_kill_boss", "###目标怪物(%d)不存在。", targetId);
            return args;
        end

        return string.format(args, name, curProgess, requireProgress);
    end,
};
